package com.thh.shirodemo.controller;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.subject.Subject;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author shkstart
 * @create 2022-07-17-23:51
 */
@RestController
@RequestMapping("/mobile")
public class MobileController {
    @RequiresPermissions("mobile")
    @RequestMapping("/query")
    public String query(){
//        也可以在ShiroConfig中配置

//        Subject currentUser = SecurityUtils.getSubject();
////        isPermitted是myRealm中授权部分添加的内容
//        if(currentUser.isPermitted("mobile")){
//            return "mobile";
//        }
//        return "error";
    return "mobile";
    }
}
